<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>立方体</title>
    <style>

        /*
        https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function
         */
        *{
            margin: 0;
            padding: 0;
        }

        body{
            perspective: 800px;
        }

        ul{
            list-style: none;
        }

        .cube{
            width: 200px;
            height: 200px;
            margin: 200px auto;
            position: relative;
            /*开启3d效果*/
            transform-style: preserve-3d;
            transition: all 10s;
        }

        .cube:hover{
            /*transform: rotateX(1turn) rotateY(1turn);*/
            transform: rotateY(45deg) scaleZ(2);
        }

        .cube li{
            width: 200px;
            height: 200px;
            opacity: .7;
            font-size: 50px;
            color: white;
            text-align: center;
            line-height: 200px;
            position: absolute;
        }

        .cube li:nth-child(1){
            background-color: tomato;
            transform: translateZ(100px);
        }

        .cube li:nth-child(2){
            background-color: #bfa;
            transform: rotateY(90deg) translateZ(100px);
        }

        .cube li:nth-child(3){
            background-color: orange;
            transform: rotateY(-90deg) translateZ(100px);

        }
        .cube li:nth-child(4){
            background-color: yellowgreen;
            transform: rotateX(90deg) translateZ(100px);

        }
        .cube li:nth-child(5){
            background-color: skyblue;
            transform: rotateX(-90deg) translateZ(100px);
        }
        .cube li:nth-child(6){
            background-color: purple;
            transform: translateZ(-100px);
        }

    </style>
</head>
<body>

<ul class="cube">
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
    <li>6</li>
</ul>

</body>
</html>